<fieldset class="solid">
	<legend>
	创建API
	<#if (api.id)??>
	<a href="${BASE_PATH!}/api/detail/${api.id}">详情</a>
	</#if>
	</legend>
	<input type="hidden" name="api.id" value="${(api.id)!}" />
	<div>
		<label>隶属项目</label>
		<select name="api.project_id" id="project_id">
		</select>
		${project_idMsg!}
	</div>
	<div>
		<label>隶属模块</label>
		<select name="api.module_id" id="module_id">
		</select>
		${project_idMsg!}
	</div>
	<div>
		<label>API名称</label>
		<input type="text" name="api.api_name" id="api_name" value="${(api.api_name)!}" />
		${api_nameMsg!}
	</div>
	<div>
		<label>API说明</label>
		<input type="text" name="api.api_comment" value="${(api.api_comment)!}" />
		${api_commentMsg!}
	</div>
	<div>
		<label>URL</label>
		<input type="text" name="api.api_url" value="${(api.api_url)!}" />
		${api_urlMsg!}
	</div>
	<div>
		<label>请求方式</label>
		<select name="api.api_request_type" id="api_request_type">
		</select>
		${api_request_typeMsg!}
	</div>
	<div>
		<label>请求参数</label>
		<textarea name="api.api_request_param">${(api.api_request_param)!}</textarea>
		${api_request_paramMsg!}
	</div>
	<div>
		<label>响应方式</label>
		<select name="api.api_response_type" id="api_response_type">
		</select>
		${api_response_typeMsg!}
	</div>
	<div>
		<label>响应参数</label>
		<textarea name="api.api_response_param">${(api.api_response_param)!}</textarea>
		${api_response_paramMsg!}
	</div>
	<div>
		<label>排序</label>
		<input type="text" name="api.api_index" value="${(api.api_index)!}" />
		${api_indexMsg!}
	</div>
	<div>
		<label>&nbsp;</label>
		<input value="提交" type="submit">
	</div>
</fieldset>
<script type="text/javascript">
$(document).ready(function(){
	var initSel_project_id = function(callback){
		SelectTool.initSelectData({
			elId:"project_id",
			url:"${BASE_PATH!}/project/listAll",
			postData:{},
			valueName:"id",
			textName:"project_name",
			defaultValue:"${(api.project_id)!}",
			callback:callback
		});
	}
	var initSel_module_id = function(callback){
		SelectTool.initSelectData({
			elId:"module_id",
			url:"${BASE_PATH!}/module/listByProjectId",
			postData:{"project_id":$("#project_id").val()},
			valueName:"id",
			textName:"module_name",
			defaultValue:"${(api.module_id)!}",
			callback:callback
		});
	}
	var initSel_api_request_type = function(callback){
		SelectTool.initSelectData({
			elId:"api_request_type",
			url:"${BASE_PATH!}/code_manager/listByNamespace",
			postData:{"namespace":"RequestType"},
			valueName:"code",
			textName:"name",
			defaultValue:"${(api.api_request_type)!}",
			callback:callback
		});
	}
	var initSel_api_response_type = function(callback){
		SelectTool.initSelectData({
			elId:"api_response_type",
			url:"${BASE_PATH!}/code_manager/listByNamespace",
			postData:{"namespace":"ResponseType"},
			valueName:"code",
			textName:"name",
			defaultValue:"${(api.api_response_type)!}",
			callback:callback
		});
	}
	$("#project_id").change(function(){
		initSel_module_id(function(){});
	});
	$("#module_id").change(function(){
		$("#api_name").val($("#module_id option:selected").text());
	});
	//初始化
	initSel_project_id(function(){
		initSel_module_id(function(){});
	});
	initSel_api_request_type(function(){});
	initSel_api_response_type(function(){});
});
</script>